#ifndef PAGE3_WIDGET_H
#define PAGE3_WIDGET_H

#include <QWidget>
#include <QDebug>
#include <stdio.h>
#include <string.h>
#include <QTimer>
#include "user/tuya_iot_kit.h"
#include "ui_welcomewidget.h"

#include "qrencode.h"
#include <QImage>
#include <QPainter>

class WelcomeWidget;



class Page3_Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Page3_Widget(WelcomeWidget *widget);
    ~Page3_Widget();

private slots:
    void on_pb_iot_connect_clicked();
    void on_pb_msg_clear_clicked();
    void iot_timer_timeout_handler();


signals:
    void signal_start_iot_thread();
    void signal_motor_ctrl(bool flag);
    void signal_light_ctrl(bool flag);

private:

    WelcomeWidget *welcomewidget;
    Ui::WelcomeWidget *welcome_ui;
    QTimer *iot_event_timer;

    Tuya_IoT_Kit_Qthread *m_tuya_iot_qthread;

    void encode_qrcode(const QString &text, QPixmap &qr_pixmap, int scale);
    void display_pairing_qrcode(bool flag);
    void display_iot_msg(QString);
    void iot_dps_handler(void);
    void iot_event_handler(void);
    void iot_data_update_handler();
};


#endif


